package org.mock.controller;

import lombok.AllArgsConstructor;
import org.mock.common.R;
import org.mock.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import org.mock.entity.BaifenhuiOrderBase;
import org.mock.dto.BaifenhuiOrderBaseDTO;

import org.mock.service.BaifenhuiOrderBaseService;

/**
 * 订单基本信息
 *
 * @author AI
 * @since 2025-05-23
 */
@RestController
@AllArgsConstructor
@RequestMapping("baifenhuiOrderBase")
public class BaifenhuiOrderBaseController {

	private BaifenhuiOrderBaseService baifenhuiOrderBaseService;

	/**
	 * 详情
	 */
	@GetMapping("/detail")
	public R<BaifenhuiOrderBase> detail(BaifenhuiOrderBaseDTO dto) {
		BaifenhuiOrderBase detail = baifenhuiOrderBaseService.getOne(dto);
		return R.data(detail);
	}

	/**
	 * 分页 订单基本信息
	 */
	@GetMapping("/page")
	public R<IPage<BaifenhuiOrderBase>> page(BaifenhuiOrderBaseDTO dto) {
		IPage<BaifenhuiOrderBase> pages = baifenhuiOrderBaseService.page(dto);
		return R.data(pages);
	}
	/**
	 * 不分页 订单基本信息
	 */
	@GetMapping("/list")
	public R<List<BaifenhuiOrderBase>> list(BaifenhuiOrderBaseDTO dto) {
		List<BaifenhuiOrderBase> list = baifenhuiOrderBaseService.list(dto);
		return R.data(list);
	}

	/**
	 * 新增 订单基本信息
	 */
	@PostMapping("/save")
	public R save(@RequestBody BaifenhuiOrderBaseDTO dto) {
		return R.data(baifenhuiOrderBaseService.save(dto));
	}

	/**
	 * 修改 订单基本信息
	 */
	@PutMapping("/update")
	public R update(@RequestBody BaifenhuiOrderBaseDTO dto) {
		return R.data(baifenhuiOrderBaseService.updateById(dto));
	}

	/**
	 * 删除 订单基本信息
	 */
	@DeleteMapping("/remove")
	public R remove(@RequestParam String ids) {
		return R.data(baifenhuiOrderBaseService.deleteLogic(Func.toIntList(ids)));
	}

}
